package com.service.impl;

import com.baseEnum.CourseType;
import com.entity.Course;
import com.mapper.CourseCategoryMapper;
import com.service.ICourseService;
import com.util.CollectionUtil;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.LinkedList;
import java.util.List;

/**
 * 课程服务类
 *
 * @Author ri.yang
 * @Since 2016/1/8.
 */
@Service
public class CourseServiceImpl extends IBaseServiceImpl<Course, Integer> implements ICourseService {
    @Resource
    private CourseCategoryMapper courseCategoryMapper;

    public List<Course> findAll() {
        return null;
    }


    public int save(Course course) {
        if (course != null) {
//            return courseCategoryMapper.save(course);
        }
        return 0;
    }

    /**
     * 批量删除
     *
     * @param ids
     * @return
     */
    public int delete(List<Integer> ids) {
        if (CollectionUtil.isNotEmpty(ids)) {
//            return courseCategoryMapper.delete(ids);
        }
        return 0;
    }

    /**
     * 删除一条记录
     *
     * @param id
     * @return
     */
    public int deleteById(Integer id) {
        List<Integer> ids = new LinkedList<Integer>();
        ids.add(id);
//        return courseCategoryMapper.delete(ids);
        return 0;
    }

    /**
     * 根据课程类型获取所有课程（必修或选修）
     *
     * @param courseType
     * @return
     */
    public List<Course> findAllCourse(CourseType courseType) {
//         return  courseCategoryMapper.findAllCourse(courseType.getValue());
        return null;
    }

    public List<Course> selectAll() {
        return courseCategoryMapper.selectAll();
    }
}
